package com.mingrisoft.demo03userregister;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends Activity {
ImageButton arrow;
EditText UserName,RealName,Email,Phone,Password,RepeatPassword;
Spinner SchoolDepartment,SchoolProfessional;
Button Register;
String UserNameValue,RealNameValue,EmailValue,PhoneValue,PasswordValue,RepeatPasswordValue,SchoolDepartmentValue,SchoolProfessionalValue;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        arrow = findViewById(R.id.arrow);
        UserName = findViewById(R.id.UserName);
        RealName = findViewById(R.id.RealName);
        Email = findViewById(R.id.Email);
        Phone = findViewById(R.id.Phone);
        Password = findViewById(R.id.Password);
        RepeatPassword = findViewById(R.id.RepeatPassword);
        SchoolDepartment = findViewById(R.id.SchoolDepartment);
        SchoolProfessional = findViewById(R.id.SchoolProfessional);
        Register = findViewById(R.id.Register);

        Register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UserNameValue = UserName.getText().toString();
                RealNameValue = RealName.getText().toString();
                EmailValue = Email.getText().toString();
                PhoneValue = Phone.getText().toString();
                PasswordValue = Password.getText().toString();
                RepeatPasswordValue = RepeatPassword.getText().toString();
                SchoolDepartmentValue = SchoolDepartment.getSelectedItem().toString();
                SchoolProfessionalValue =  SchoolProfessional.getSelectedItem().toString();

                Toast.makeText(MainActivity.this, "用户名:"+UserNameValue+"--真实姓名:"+RealNameValue+"--邮箱:"+EmailValue+"--电话:"+PhoneValue+"--就读部门:"+SchoolDepartmentValue+"--就读专业:"+SchoolProfessionalValue+"--密码:"+PasswordValue+"--重复密码:"+RepeatPasswordValue, Toast.LENGTH_SHORT).show();
            }
        });
    }
}